import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, ViewController} from 'ionic-angular';
import {StorageProvider} from "@providers/storage";

/**
 * 订单状态选择弹窗
 */

@IonicPage()
@Component({
  selector: 'page-manager-status-choose',
  templateUrl: 'manager-status-choose.html',
})
export class ManagerStatusChoosePage {
  status = this.navParams.data;
  statuses: any[] = [];
  userInfo: any;

  constructor(public navCtrl: NavController,
              public navParams: NavParams,
              private viewCtrl: ViewController,
              private storageService: StorageProvider) {
    this.userInfo = this.storageService.read('userInfo');
  }

  ionViewDidLoad() {
    this.getStatus()
  }

  //获取状态
  getStatus() {
    let temp = (this.userInfo.GW || []).filter(value => {
      return value.KEY == 'YW';
    });
    this.statuses = temp.length > 0 ? temp[0].VALUE : [
      {
        KEY: 'ALL',
        VALUE: '全部'
      },
      {
        KEY: 'DPG',
        VALUE: '待派工'
      },
      {
        KEY: 'XXSH',
        VALUE: '信息审核'
      }
    ];
  }

  close(data) {
    this.viewCtrl.dismiss(data);
  }
}
